;
(function($, window, document, undefined) {
	
	var $ajax = function(param) {
		
		param.dataType = param.dataType || "json";
		param.data = param.data || {};
		param.headers = param.headers || {};
		param.error = param.error || function(e, textStatus, errorThrown) {
			// alert("服务器无响应，请联系管理员！错误信息：" + errorThrown);
		}
		var ETtoken = window.sessionStorage.getItem("ETtoken");
		if (!ETtoken) {
			ETtoken = window.localStorage.getItem("ETtoken");
		}
		param.headers.ETtoken = ETtoken;
		param.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
		
		var hasIE8 = browserMatch.browser == "Microsoft IE" && parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE", "")) <= 9;
		// 判断当前浏览器是否IE9以下
		if (hasIE8) {
			jQuery.support.cors = true;
			if (!param.async) {
				param.async = true;
			}
			if (param.url.indexOf("?") > -1) {
				param.url += "&ETtoken=" + ETtoken;
			} else {
				param.url += "?ETtoken=" + ETtoken;
			}
			if (param.type && param.type.toLocaleUpperCase() == "POST") {
				param.contentType = "application/json;charset=UTF-8";
			}
		}
		
		$.ajax(param);
	}

	// 最后将插件对象暴露给全局对象
	window.$ajax = $ajax;
})(jQuery, window, document);
